package com.xbongbong.saas.model.impl;

import com.xbongbong.paas.toolbox.util.CollectionsUtil;
import com.xbongbong.saas.domain.dao.ClueWorkLogDao;
import com.xbongbong.saas.domain.entity.ClueWorkLogEntity;
import com.xbongbong.saas.model.ClueWorkLogModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author long
 * @version v1.0
 * @date 2020/11/12 13:43
 * @since v1.0
 */
@Service("clueWorkLogModel")
public class ClueWorkLogModelImpl implements ClueWorkLogModel {

    @Resource
    private ClueWorkLogDao clueWorkLogDao;

    @Override
    public List<ClueWorkLogEntity> findEntitys(Map<String, Object> modelMap) {
        return clueWorkLogDao.findEntitys(modelMap);
    }

    @Override
    public void insertBatch(List<ClueWorkLogEntity> clueWorkLogList) {
        if (CollectionsUtil.isNotEmpty(clueWorkLogList)) {
            clueWorkLogDao.insertBatch(clueWorkLogList);
        }
    }

    @Override
    public void save(ClueWorkLogEntity customerWorkLogEntity) {
        if (customerWorkLogEntity.getId() == null){
            clueWorkLogDao.insert(customerWorkLogEntity);
        }else {
            clueWorkLogDao.update(customerWorkLogEntity);
        }
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return clueWorkLogDao.getEntitysCount(param);
    }
}
